#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    vector<vector<string>> groupAnagrams(vector<string>& strs) {
        unordered_map<string, vector<string>> hash;
        for (auto& ch : strs) {
            string tmp = ch;
            sort(ch.begin(), ch.end());
            hash[ch].push_back(tmp);
        }
        vector<vector<string>> ans;
        for (auto& [x, y] : hash) {
            ans.push_back(y);
        }
        return ans;
    }
};